package com.example.demo1.util;

import java.security.MessageDigest;

import org.apache.tomcat.util.codec.binary.Base64;

public class md5Util {

    private static final String MD5_SALT1 = "#^&DFgsGHJ$%OEFD>?.=VDFGTYH456CVBsaNHJK";
    private static final String MD5_SALT2 = "TYsGVDHdadad54J5HKHC#^?.=6&%OEFVBsaN4J$D>Fg";

    public static final String getMD5String(String string) throws Exception {
        string = MD5_SALT1 + string + MD5_SALT2 + string;
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        return Base64.encodeBase64String(md5.digest(string.getBytes()));
    }

}
